<script setup lang="ts">
import {computed} from 'vue';

const props = withDefaults(
  defineProps<{
    value: any;
    item: any;
  }>(),
  {
    value: undefined,
    item: () => {},
  },
);

const {item} = props;
const emit = defineEmits<{
  'update:value': [value: any];
}>();

const value = computed({
  get: () => props.value,
  set: (value) => {
    emit('update:value', value);
  },
});
</script>

<template>
  <a-select v-model:value="value" :placeholder="item.placeholder || '请选择'" v-bind="item">
    <a-select-option v-for="(optionItem, optionIndex) in item.options" :value="optionItem.value" :key="optionIndex">
      {{ optionItem.label }}
    </a-select-option>
  </a-select>
</template>

<style lang="less" scoped></style>
